<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Multi threaded environment: GNOME Data Access 5 manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="GNOME Data Access 5 manual">
<link rel="up" href="libgda-provider-class.html" title="Virtual methods for providers">
<link rel="prev" href="libgda-provider-class.html" title="Virtual methods for providers">
<link rel="next" href="ch44s03.html" title="Methods - provider's information">
<meta name="generator" content="GTK-Doc V1.32 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="libgda-provider-class.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="libgda-provider-class.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="ch44s03.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="sect1">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="id-1.9.7.6"></a>Multi threaded environment</h2></div></div></div>
<p>
      Each database provider should be usable in a multi threaded environment, even if they impose some restrictions
      as to how they can be used in such an environment. The <span class="application">Libgda</span>'s framework provides some locking mechanism which
      is:
      </p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>if multi threading cannot be supported at all (for example if the client library internally
	    used by the provider does not support it), then  the provider's
	    class implementation should set the class's <em class="structfield"><code>limiting_thread</code></em> attribute to:
	    the GDA_SERVER_PROVIDER_UNDEFINED_LIMITING_THREAD constant.
	    This constant will be resolved at run time as the thread which creates the 1st connection using that
	    provider.</p></li>
<li class="listitem"><p>if multi threading is supported but any connection (or related object) can only be 
	    used by the thread in which it was created, then for each opened connection, the 
	    "<a class="link" href="GdaConnection.html#GdaConnection--thread-owner" title="The “thread-owner” property">thread-owner</a>" connection's property
	    must be set to the current thread (and other related objects must be locked in a similar way)</p></li>
<li class="listitem"><p>if no locking is done, then the provider is assumed to support full multi threading access,
	  in this case make sure to set class's <em class="structfield"><code>limiting_thread</code></em> attribute to the NULL constant.</p></li>
</ul></div>
<p>
    </p>
<p>
      Note that the default provider's class value for the <em class="structfield"><code>limiting_thread</code></em> is safely set to the
      GDA_SERVER_PROVIDER_UNDEFINED_LIMITING_THREAD constant.
    </p>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.32</div>
</body>
</html>